package com.xiaotu.utils;


/**
 * 附件类型，枚举类
 *
 * @author
 */
public enum AttachmentType {

    /**
     * Word文档
     */
    Word("1"),

    /**
     * 图片
     */
    Picture("2"),

    /**
     * 音频
     */
    Audio("3"),

    /**
     * 视频
     */
    Video("4"),
    /**
     * excel
     */
    Excel("5"),
    /**
     * excel
     */
    Pdf("6"),

    /**
     * 其他
     */
    Others("99");

    private String value;

    private AttachmentType(String value) {
        this.value = value;
    }

    public String getValue() {
        return this.value;
    }

    public static AttachmentType valueOf(int value) {
        for (AttachmentType item : AttachmentType.values()) {
            if (item.value.equals(value)) {
                return item;
            }
        }
        throw new IllegalArgumentException("附件类型不支持：" + value);
    }

    public static AttachmentType nameOf(String name) {
        for (AttachmentType item : AttachmentType.values()) {
            if (item.toString().equals(name)) {
                return item;
            }
        }
        throw new IllegalArgumentException("附件类型不支持：" + name);
    }
}
